package com.web.Servlet;

import com.Service.BrandService;
import com.pojo.Brand;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/selectServlet")
public class selectServlet extends HttpServlet {

    private BrandService service=new BrandService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        List<Brand> brands = service.selectAll();
        //1请求转发
        //1.1存到request域中
        request.setAttribute("brands",brands);

        //1.2转发到页面中
        request.getRequestDispatcher("/Brand.jsp").forward(request,response);



    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
